home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / gemfsc15.lzh / AESSRC14.LZH / AESUTRC5.S < prev    next >
Text File  |  1989-08-26  |  3KB  |  77 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8. ;*************************************************************************
  9. ;*
  10. ;* AESUTRC5.S - Rectangle utilities 5
  11. ;*  Utility routines involving non-standard rectangle calcs...
  12. ;*
  13. ;*************************************************************************
  14.  
  15. ;-------------------------------------------------------------------------
  16. ;       
  17. ; rc_gadjust -   Adjust a GRECT rectangle.
  18. ; rc_vadjust -   Adjust a VRECT rectangle.
  19. ;
  20. ;                These functions will expand or contract a rectangle 
  21. ;                (GRECT = rc_gadjust or VRECT = rc_vadjust) by a given 
  22. ;                size in each axis.  
  23. ;
  24. ;                A positive adjustment expands the area, and a negative
  25. ;                adjustment shrinks it.
  26. ;
  27. ;  void rc_Xadjust(&rect, horiz_adjust, vert_adjust);
  28. ;-------------------------------------------------------------------------
  29.  
  30. _rc_gadjust::
  31.  
  32.           moveq.l   #1,d2               ; Set GRECT-flag.
  33.           bra.s     adjust              ; Continue below.
  34.           
  35. _rc_vadjust::
  36.  
  37.           moveq.l   #0,d2               ; Clear GRECT-flag.
  38.  
  39. adjust:                                 ; Common code...
  40.  
  41.           .cargs    #4,.prect.l,.hadj,.vadj
  42.           
  43.           move.l    .prect(sp),a0       ; Get rectangle pointer.
  44.           move.w    .hadj(sp),d0        ; Get x-axis adjustment.
  45.           move.w    .vadj(sp),d1        ; Get y-axis adjustment.
  46.  
  47.           sub.w     d0,(a0)             ; Adjust g_x (or v_x1).
  48.           bpl.s     .notneg1            ; If adjusted value is negative,
  49.           clr.w     (a0)                ; force it back to zero.
  50. .notneg1:
  51.           addq.l    #2,a0
  52.           sub.w     d1,(a0)             ; Adjust g_y (or v_y1).
  53.           bpl.s     .notneg2            ; If adjusted value is negative,
  54.           clr.w     (a0)                ; force it back to zero.
  55. .notneg2:
  56.           addq.l    #2,a0
  57.           
  58.           tst.w     d2                  ; Test GRECT flag.
  59.           beq.s     .no_double          ; Skip doubling if VRECT.
  60.  
  61.           add.w     d0,d0               ; For GRECTs we have to double the
  62.           add.w     d1,d1               ; adjustment to width & height.
  63. .no_double:
  64.           add.w     d0,(a0)             ; Adjust g_w (or v_x2).
  65.           bpl.s     .notneg3            ; If adjusted value is negative,
  66.           clr.w     (a0)                ; force it back to zero.
  67. .notneg3:
  68.           addq.l    #2,a0
  69.           add.w     d1,(a0)             ; Adjust g_h (or v_y2).
  70.           bpl.s     .notneg4            ; If adjusted value is negative,
  71.           clr.w     (a0)                ; force it back to zero.
  72. .notneg4:
  73.           rts                           ; Return.
  74.                 
  75. ;         end of code
  76.  
  77.